package com.anzia.demo07;

import java.util.Arrays;

/**
 *@ClassName String1_Demo
 *@Description
 *@Author Anzia.
 *@Date 2021/4/11 17:03
 *@Version 1.0
 **/
public class String1_Demo {
    public static void main(String[] args) {
        String str = "this is a text";

        System.out.println("------------");
        String[] s = str.split(" ");
        for (String string : s) {
            System.out.println(string);
        }

        System.out.println("------------");
        System.out.println(str.replace("text", "practice"));

        System.out.println("------------");
        System.out.println(str.replace("text","easy text"));

        System.out.println("------------");
        for (int i = 0; i < s.length; i++) {
            char first = s[i].charAt(0);
            char upperCase = Character.toUpperCase(first);
            String news = upperCase + s[i].substring(1);
            System.out.println(news);
        }

    }
}
